home *** CD-ROM | disk | FTP | other *** search
/ MacFormat 1995 March / macformat-022.iso / Shareware City / Developers / MW MPW Binaries 1.1.1a2 / mwcPPC / MWCIncludes / stdlib.h < prev    next >
Encoding:
C/C++ Source or Header  |  1994-07-18  |  2.9 KB  |  119 lines  |  [TEXT/MMCC]

  1. /* stdlib.h standard header */
  2. #ifndef _STDLIB
  3. #define _STDLIB
  4. #ifndef _YVALS
  5. #include <yvals.h>
  6. #endif
  7.  
  8. #if __MWERKS__
  9. #pragma options align=mac68k
  10. #endif
  11.  
  12.         /* macros */
  13. #ifndef NULL
  14. #define NULL             _NULL
  15. #endif
  16. #define EXIT_FAILURE    _EXFAIL
  17. #define EXIT_SUCCESS    0
  18. #define MB_CUR_MAX    _Mbcurmax
  19. #define RAND_MAX    32767
  20.         /* type definitions */
  21. #ifndef _SIZET
  22. #define _SIZET
  23. typedef _Sizet size_t;
  24. #endif
  25. #ifndef _WCHART
  26. #define _WCHART
  27. typedef _Wchart wchar_t;
  28. #endif
  29. typedef struct {
  30.     int quot;
  31.     int rem;
  32.     } div_t;
  33. typedef struct {
  34.     long quot;
  35.     long rem;
  36.     } ldiv_t;
  37. typedef int _Cmpfun(const void *, const void *);
  38.         /* declarations */
  39. _EXTERN_C /* low-level functions */
  40. int atexit(void (*)(void));
  41. void exit(int);
  42. #if __MWERKS__
  43. int _atexit(void (*)(void));
  44. void _exit(int);
  45. #endif
  46. char *getenv(const char *);
  47. int system(const char *);
  48. _END_EXTERN_C
  49. _C_LIB_DECL
  50. void abort(void);
  51. int abs(int);
  52. void *bsearch(const void *, const void *, size_t, size_t,
  53.     _Cmpfun *);
  54. void *calloc(size_t, size_t);
  55. div_t div(int, int);
  56. void free(void *);
  57. long labs(long);
  58. ldiv_t ldiv(long, long);
  59. void *malloc(size_t);
  60. int mblen(const char *, size_t);
  61. size_t mbstowcs(wchar_t *, const char *, size_t);
  62. int mbtowc(wchar_t *, const char *, size_t);
  63. void qsort(void *, size_t, size_t, _Cmpfun *);
  64. int rand(void);
  65. void *realloc(void *, size_t);
  66. long strtol(const char *, char **, int);
  67. size_t wcstombs(char *, const wchar_t *, size_t);
  68. int wctomb(char *, wchar_t);
  69. double _Stod(const char *, char **, long);
  70. float _Stof(const char *, char **, long);
  71. int _Stoflt(const char *, char **, long[], int);
  72. long double _Stold(const char *, char **, long);
  73. unsigned long _Stoul(const char *, char **, int);
  74. extern char _Mbcurmax;
  75. extern unsigned long _Randseed;
  76. _END_C_LIB_DECL
  77.         /* inlines, for C++ */
  78. #ifdef __cplusplus
  79. inline double atof(const char *_S)
  80.     {return (_Stod(_S, 0, 0)); }
  81. inline int atoi(const char *_S)
  82.     {return ((int)_Stoul(_S, 0, 10)); }
  83. inline long atol(const char *_S)
  84.     {return ((long)_Stoul(_S, 0, 10)); }
  85. inline void srand(unsigned int _Seed)
  86.     {_Randseed = _Seed; }
  87. inline double strtod(const char *_S, char **_Endptr)
  88.     {return (_Stod(_S, _Endptr, 0)); }
  89. inline unsigned long strtoul(const char *_S, char ** _Endptr,
  90.     int _Base)
  91.     {return (_Stoul(_S, _Endptr, _Base)); }
  92. #else
  93.         /* declarations and macro overrides, for C */
  94. double atof(const char *);
  95. int atoi(const char *);
  96. long atol(const char *);
  97. void srand(unsigned int);
  98. double strtod(const char *, char **);
  99. unsigned long strtoul(const char *, char **, int);
  100. #define atof(s)        _Stod(s, 0, 0)
  101. #define atoi(s)        (int)_Stoul(s, 0, 10)
  102. #define atol(s)        (long)_Stoul(s, 0, 10)
  103. #define srand(seed)    (void)(_Randseed = (seed))
  104. #define strtod(s, endptr)    _Stod(s, endptr, 0)
  105. #define strtoul(s, endptr, base)    _Stoul(s, endptr, base)
  106. #endif /* __cplusplus */
  107.  
  108. #if __MWERKS__
  109. #pragma options align=reset
  110. #endif
  111.  
  112. #endif /* _STDLIB */
  113.  
  114. /*
  115.  * Copyright (c) 1994 by P.J. Plauger.  ALL RIGHTS RESERVED. 
  116.  * Consult your license regarding permissions and restrictions.
  117.  */
  118.  
  119.